package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmSensitiveDto;
import com.heima.model.wemedia.pojos.WmSensitive;
import com.heima.wemedia.service.WmSensitiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/sensitive")
public class WmSensitiveController {

    @Autowired
    private WmSensitiveService wmSensitiveService;


    /**
     * 敏感词分页查询
     * @param dto
     * @return
     */
    @PostMapping("/list")
    public ResponseResult findList(@RequestBody WmSensitiveDto dto) {
        return wmSensitiveService.findList(dto);
    }

    /**
     * 敏感词新增
     */
    @PostMapping("/save")
    public ResponseResult insert(@RequestBody WmSensitive wmSensitive){
        return wmSensitiveService.insert(wmSensitive);
    }

    /**
     * 敏感词更新
     */
    @PostMapping("/update")
    public ResponseResult update(@RequestBody WmSensitive wmSensitive){
        return wmSensitiveService.updateSeneitive(wmSensitive);
    }

    /**
     * 敏感词删除
     */
    @DeleteMapping("/del/{id}")
    public ResponseResult delete(@PathVariable Integer id){
        return wmSensitiveService.delete(id);
    }
}
